#-*- coding: utf-8 -*-
#from django.template.loader import get_template
#from django.template import Context

from django.shortcuts import render_to_response
from django.http import HttpResponse
import datetime

def hello(request):
    return HttpResponse(u"Hello word! Привет мир!")

# def current_datetime(request):
#     now = datetime.datetime.now()
#     html = "<html><body>Сейчас %s .</body></html>" % now
#     return HttpResponse(html)

def current_datetime(request):
    #now = datetime.datetime.now()
    # t = get_template('current_datetime.html')
    # html = t.render(Context({'current_date': now}))
    # return HttpResponse(html)
    current_date = datetime.datetime.now()
    texte = "this sample my texttt"
    return render_to_response('current_datetime.html', locals())

def hours_ahead(request, offset):
    try:
        offset = int(offset)
    except ValueError:
        raise Http404()
    dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
    html = u"<html><body>Через %s часов будет %s.</body></html>" % (offset, dt)
    return HttpResponse(html)

def display_meta(request):
    rq = ({'path': request.path, 'host': request.get_host(),
           'fpath': request.get_full_path(), 'sec': request.is_secure()})
    values = request.META.items()
    values.sort()
    return render_to_response('meta.html', locals())

def debug(request):
    current_date = datetime.datetime.now()
    return render_to_response('current_datetime.html', locals())

